﻿using System;
using System.Threading.Tasks;

namespace Sharp.Portal.Mvc.OAuth.Sharp.Provider
{
    public class SharpAuthenticationProvider : ISharpAuthenticationProvider
    {
        public SharpAuthenticationProvider()
        {
            OnAuthenticated = (c) => Task.FromResult<SharpAuthenticatedContext>(null);
            OnReturnEndpoint = (c) => Task.FromResult<SharpReturnEndpointContext>(null);
        }

        public Func<SharpAuthenticatedContext, Task> OnAuthenticated { get; set; }
        public Func<SharpReturnEndpointContext, Task> OnReturnEndpoint { get; set; }

        public Task Authenticated(SharpAuthenticatedContext context)
        {
            return OnAuthenticated(context);
        }

        public Task ReturnEndpoint(SharpReturnEndpointContext context)
        {
            return OnReturnEndpoint(context);
        }
    }
}
